#include <iostream>
#include <algorithm>
#define MAXN 100005
#define INF 1000000000
using namespace std;
int N, M;
int x[MAXN];
void solve();
int main() {
    cin >> N >> M;
    for (int i = 0; i < N; i++) cin >> x[i];
    solve();
    return 0;
}

bool C(int d) {
    int res = 1, last = 0;
    for (int i = 1; i < N; i++) {
        if (x[i] - x[last] >= d) {
            last = i; res++;
        } 
    }
    return res >= M;
}

void solve() {
    sort(x, x + N);
    int lower = 0, upper = INF;
    // [ )
    while (upper - lower > 1) {
        int middle = (lower + upper) / 2;
        if (C(middle)) lower = middle;
        else upper = middle;
    }
    cout << lower << endl;
}